var business_announcement={
	init:function(){

		var that = this;
		that.didaction();
	},
	didaction:function(){

		

		$('#datepicker_s').datetimepicker({
        language:  'zh-CN',
        weekStart: 1,
        todayBtn:  1,
		autoclose: 1,
		todayHighlight: 1,
		startView: 2,
		minView: 2,
		forceParse: 0,
		format: 'yyyy-mm-dd hh:mm'
    });

		$('#datepicker_e').datetimepicker({
        language:  'zh-CN',
        weekStart: 1,
        todayBtn:  1,
		autoclose: 1,
		todayHighlight: 1,
		startView: 2,
		minView: 2,
		forceParse: 0,
		format: 'yyyy-mm-dd hh:mm'
    });


	jQuery.validator.addMethod("isMobile", function(value, element) {
    var length = value.length;
    var mobile = /^(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})$/;
    return this.optional(element) || (length == 11 && mobile.test(value));
}, "填写正确的手机号码");
	
	$("#baseForm").validate({     
	rules: {
		account_no: "required",
		company_name:'required',
		address:'required',
		contact:'required',
		phone:{
			minlength : 11,
            isMobile : true
		}
	},
	messages:{
		account_no: "请输入用户名",
		company_name:"请输入企业名称",
		address:'请输入详细地址',
		contact:'请输入联系人',
		phone : {
                    
                      minlength : "请确认手机不能小于11个字符",
                      isMobile : "填写正确的手机号码"
                  },
	},
	 submitHandler: function(form) 
	   {      
	      $.ajax({ 
			url : COMMONURL+"api/company/Add", 
			type : "post", 
			dataType : "json", 
			data: {
				account_no:'2222'
			}
			}).done(function(data){
				alert(data)
			})  
	   } 
	 }) 

	}
}

business_announcement.init();